package jgrouse.jgdoc.elements;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import jgrouse.jgdoc.api.IDocElement;
import jgrouse.jgdoc.api.IDocElementList;

public class DocElementList extends ArrayList<IDocElement> implements IDocElementList
{

	private static final long serialVersionUID = -12712359919526269L;

	public IDocElementList sortByFull()
	{
		Collections.sort(this, new Comparator<IDocElement>()
			{
				public int compare(IDocElement pO1, IDocElement pO2)
				{
					return pO1.getFullName().compareTo(pO2.getFullName());
				}
			});
		return this;
	}

	public IDocElementList sortByLocal()
	{
		Collections.sort(this, new Comparator<IDocElement>()
				{
					public int compare(IDocElement pO1, IDocElement pO2)
					{
						return pO1.getLocalName().compareTo(pO2.getLocalName());
					}
				});
		return this;
		
	}

}
